package com.imy.luascript.base.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.TextView;

import com.imy.luascript.R;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @ProjectName: frame
 * @Package: com.imy.frame.view
 * @ClassName: Toolbar
 * @Description: 描述
 * @Author: 蒋明伟
 * @CreateDate: 2020/10/26 16:36
 */
public class Toolbar extends BaseCustomViewLifecycle {
    @BindView(R.id.toolbar_back_btn)
    ImageView toolbarBackBtn;
    @BindView(R.id.toolbar_title)
    TextView toolbarTitle;

    public Toolbar(Context context) {
        super(context);
    }

    public Toolbar(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public Toolbar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected int getLayoutID() {
        return R.layout.toolbar;
    }

    @OnClick(R.id.toolbar_back_btn)
    public void onToolbarBackBtnClicked() {
        activity.finish();
    }

    @OnClick(R.id.toolbar_title)
    public void onToolbarTitleClicked() {
    }

    public void setTitle(String string) {
        toolbarTitle.setText(string);
    }
    public void hideBackBtn(){
        toolbarBackBtn.setVisibility(GONE);
    }
    public ImageView getToolbarBackBtn() {
        return toolbarBackBtn;
    }
}